@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.5;
  font-weight: 400;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  
  /* 绘本岛品牌色彩变量 */
  --huiben-cream: #FAF8F3;
  --huiben-yellow: #FFF8DC;
  --huiben-sky: #E6F3FF;
  --huiben-green: #90EE90;
  --huiben-pink: #FFB6C1;
  --huiben-gray: #D3D3D3;
  --huiben-dark: #666666;
  --huiben-sky-light: #B3D9FF;
  --huiben-sky-dark: #2C5282;
}

/* 全局样式重置 */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--huiben-cream);
  color: var(--huiben-dark);
  font-family: inherit;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--huiben-cream);
}

::-webkit-scrollbar-thumb {
  background: var(--huiben-sky);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--huiben-sky-light);
}

/* 安全区域适配 */
.safe-area-pt {
  padding-top: env(safe-area-inset-top, 0);
}

.safe-area-pb {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.safe-area-pl {
  padding-left: env(safe-area-inset-left, 0);
}

.safe-area-pr {
  padding-right: env(safe-area-inset-right, 0);
}

/* 文本截断 */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 动画效果 */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes bounce-soft {
  0%, 100% {
    transform: translateY(-5%);
  }
  50% {
    transform: translateY(0);
  }
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-bounce-soft {
  animation: bounce-soft 2s infinite;
}

/* 按钮点击效果 */
.btn-press:active {
  transform: scale(0.95);
  transition: transform 0.15s ease;
}

/* 卡片悬停效果 */
.card-hover {
  transition: all 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

/* 页面切换动画 */
.page-transition {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}